package z.sample.servicecommons.dto;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@XmlRootElement(name = "Employee")
@XmlAccessorType(value = XmlAccessType.FIELD)
public class EmployeeDTO {
	@XmlElement(name = "Id")
	private Long id;
	
	@XmlElement(name = "LastName")
	private String lastName;
	
	@XmlElement(name = "FirstName")
	private String firstName;
	
	@XmlElement(name = "Extension")
	private String extension;
	
	@XmlElement(name = "Email")
	private String email;
	
	@XmlElement(name = "Office")
	private OfficeDTO office;
	
	@XmlTransient
	private EmployeeDTO reportTo;
	
	@XmlElement(name = "JobTitle")
	private String jobTitle;

	public Long getId() {
		return id;
	}

	public String getLastName() {
		return lastName;
	}

	public String getFirstName() {
		return firstName;
	}

	public String getExtension() {
		return extension;
	}

	public String getEmail() {
		return email;
	}

	public OfficeDTO getOffice() {
		return office;
	}

	public EmployeeDTO getReportTo() {
		return reportTo;
	}

	public String getJobTitle() {
		return jobTitle;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public void setExtension(String extension) {
		this.extension = extension;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setOffice(OfficeDTO office) {
		this.office = office;
	}

	public void setReportTo(EmployeeDTO reportTo) {
		this.reportTo = reportTo;
	}

	public void setJobTitle(String jobTitle) {
		this.jobTitle = jobTitle;
	}
	
	@XmlElement(name = "ReportTo")
	public String getReportToName() {
		if (this.reportTo == null) {
			return "";
		}
		return this.reportTo.firstName + " " + this.reportTo.lastName;
	}
}
